import socket
import struct

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

try:
  client.connect(("localhost", 9999))

  num = input("Please enter in an integer:\t")

  client.sendall(struct.pack("!i", num))

  response = struct.unpack("!d", client.recv(8))[0] # float(client.recv(1024))

  print("Sent %d and received %f." % (num, response))
finally:
  client.close()
